package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class AdminLogout extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException{
		
		response.setContentType("text/html");
		response.setCharacterEncoding("UTF-8");
		
		//清除session
		HttpSession session = request.getSession(true);
		
		String cityId = session.getAttribute("cityId") + "";
		
		session.setAttribute("curradmin", "");
		session.setAttribute("cityId", "");
		//request.getSession().invalidate();
		
		 response.sendRedirect(request.getContextPath() + "/admin/login.jsp" + "?cid=" + cityId);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
